set more off

use dataset, clear

local covariates20142010r pctwhite pct65plus pcths lmedianincome logvap2014 demvoteshare2012 registration2010 swing2012 Gub2010 Sen2010 Gub2010Sen2010 Gub2014 Sen2014 Gub2014Sen2014
local covariates20162012r pctwhite pct65plus pcths lmedianincome logvap2016 demvoteshare2012 registration2012 swing2012
local covariates20142010t pctwhite pct65plus pcths lmedianincome logvap2014 demvoteshare2012 turnout2010 swing2012 Gub2010 Sen2010 Gub2010Sen2010 Gub2014 Sen2014 Gub2014Sen2014
local covariates20162012t pctwhite pct65plus pcths lmedianincome logvap2016 demvoteshare2012 turnout2012 swing2012

keep if abs(x) < 100

su pcteligible2013
replace pcteligible2013 = pcteligible2013*100
label variable pcteligible2013 "Eligibility"

eststo clear

eststo: reg dregistration20142010 pcteligible2013 `covariates20142010r' if z == 0, robust
eststo: reg dregistration20142010 pcteligible2013 `covariates20142010r' if z == 1, robust
eststo: reg dregistration20162012 pcteligible2013 `covariates20162012r' if z == 0, robust
eststo: reg dregistration20162012 pcteligible2013 `covariates20162012r' if z == 1, robust
 
#delimit;

esttab
	using "_output/tableA14a.tex"
	,
		label
		cells(b(fmt(2)) se(par))
		replace
		se
		nostar
		keep(pcteligible2013) 
		compress
		booktabs
		mtitles("Not Expanding" "Expanding" "Not Expanding" "Expanding")
		collabels(none)
		nonum
		mgroups("2014-2010" "2016-2012", pattern(1 0 1 0)
			prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))
		stats(N r2, label("Number of Counties" "R-Squared") fmt(%20.0fc %20.02fc))
		;
		
#delimit cr

eststo clear

eststo: reg dturnout20142010 pcteligible2013 `covariates20142010t' if z == 0, robust
eststo: reg dturnout20142010 pcteligible2013 `covariates20142010t' if z == 1, robust
eststo: reg dturnout20162012 pcteligible2013 `covariates20162012t' if z == 0, robust
eststo: reg dturnout20162012 pcteligible2013 `covariates20162012t' if z == 1, robust
 
#delimit;

esttab
	using "_output/tableA14b.tex"
	,
		label
		cells(b(fmt(2)) se(par))
		replace
		se
		nostar
		keep(pcteligible2013) 
		compress
		booktabs
		mtitles("Not Expanding" "Expanding" "Not Expanding" "Expanding")
		collabels(none)
		nonum
		mgroups("2014-2010" "2016-2012", pattern(1 0 1 0)
			prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))
		stats(N r2, label("Number of Counties" "R-Squared") fmt(%20.0fc %20.02fc))
		;
		
#delimit cr
